package com.yantong.constant;

import java.util.*;

/**
 *余额历史记录类型
 * @author kanghaixin
 * 1、用户提现2、用户提现失败3、用户充值4、用户扣款5、团长发佣金6、团长提现7、团长提现失败8、团长充值9、团长扣款10、团长退款
 * 11、供应商货款结算12、供应商提现13、供应商提现失败14、供应商充值15、供应商扣款16、用户提现申请17、团长提现申请18、供应商提现申请
 * 19、供应商保证金缴纳、20、供应商保证金退至余额
 * @date 2018/9/19.11:06
 */
public enum CommissionLogType {
    order(1, "订单"),
    ref(2, "推荐"),
    versionRef(3, "版本推荐"),
    versionAgent(4, "版本代理"),
    userRef(5, "用户推荐人"),
    userUpRef(6, "用户推荐人上级"),


    mendianStaff(8, "门店店员佣金"),
    feedingAgent(9, "进件系统代理佣金"),
    feedingBranchOffice(10, "进件系统分公司佣金"),
    freePackageCommission(11, "免单礼包分拥"),
    freePackageVip(12, "免单会员分拥"),
    storesShareCommission(13, "门店推荐人分拥"),
    freePackageCommissionShare(14, "大礼包分享分拥"),
    freePackageCommissionOne(15, "大礼包一级推荐人分拥"),
    freePackageCommissionTwo(16, "大礼包二级推荐人分拥"),

    TwitterCommission(21, "推客直推"),
    HousekeeperCommission(22, "管家直推"),
    SupervisorCommission(23, "主管直推"),
    SuperShopkeeperCommission(24, "超级店主直推"),
    PartnerCommission(25, "合伙人直推"),
    TwitterTeamCommission(26, "推客团队"),
    HousekeeperTeamCommission(27, "管家团队"),
    SupervisorTeamCommission(28, "主管团队"),
    PartnerTeamCommission(29, "合伙人团队"),
    GroupCommissionOne(30, "拼团一级分佣"),
    GroupCommissionTwo(31, "拼团二级分佣"),
    GroupCommissionSponsor(32, "拼团发起人分佣"),
    cardAgentCommission(40, "电子名片代理商分拥"),
    MerchantsCommission(50, "商户入驻直推佣金"),
    StoresCommission(51, "门店入驻直推佣金"),
    StoresPartnerCommission(52, "门店入驻代理商佣金"),
    userAgent(53, "用户代理"),
    referenceUserAgent(54,"推荐代理人佣金"),
    AccountManagerCommission(55,"客户经理佣金"),
    ProductShareCommission(56,"商品分享佣金"),
    userAgentRecommendStoreCommission(57,"用户代理推荐门店佣金"),
    accountManagerRecommendStoreCommission (58,"客户经理推荐门店佣金"),
    storeRecommendStoreCommission(59,"门店推荐门店佣金"),
    makerRecommendStoreCommission(60,"创客推荐门店佣金"),
    initiatorcommission(61,"创客拼团发起人佣金"),
    generalMemberCommission(62,"普通会员发起人佣金"),
    ;

    private Integer type;

    private String name;

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private static Map<Integer, String> all= new HashMap<>();
    static{
        for(CommissionLogType commissionLogType: EnumSet.allOf(CommissionLogType.class)){
            all.put(commissionLogType.type, commissionLogType.name);
        }
    }

    public static String get(Integer code) {
        return all.get(code);
    }

    public static List<Map<String,Object>> getBalanceLogStyles() {
        List<Map<String,Object>> list = new ArrayList<>();
        for (CommissionLogType style: CommissionLogType.values()) {
            Map<String,Object> map = new HashMap<>();
            map.put("type", style.getType());
            map.put("name", style.getName());
            list.add(map);
        }
        return list;
    }
    CommissionLogType(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

//    public static String getValue(Integer type) {
//        CommissionLogType[] commissionLogTypes = values();
//        for (CommissionLogType commissionLogType : commissionLogTypes) {
//            if (commissionLogType.type().equals(type)) {
//                return commissionLogType.value();
//            }
//        }
//        return null;
//    }
//
//    public static Integer getType(String desc) {
//        CommissionLogType[] commissionLogTypes = values();
//        for (CommissionLogType commissionLogType : commissionLogTypes) {
//            if (commissionLogType.value().equals(desc)) {
//                return commissionLogType.type();
//            }
//        }
//        return null;
//    }
//    private Integer type() {
//        return this.type;
//    }
//
//    private String value() {
//        return this.name;
//    }
}
